/*
 * Base.h
 *
 *  Created on: 2011-9-27
 *      Author: stargui
 */

#ifndef BASE_H_
#define BASE_H_

namespace PROTOCOL
{

#define MAX_UDP_PACKAGE_SIZE	1400

#define VERSION_STRING		"1.0.0"

#define MODULE				"MODULE"
#define OPERATION				"OPERATION"
#define PARAMETER				"PARAMETER"
#define REQUEST				"REQUEST"
#define RESPONSE				"RESPONSE"
#define SESSION				"SESSION"
#define DESTINATION			"DESTINATION"
#define NAME					"NAME"
#define TYPE					"TYPE"
#define RANGE					"RANGE"
#define VALUE					"VALUE"

#define REQUEST_TYPE			"REQUEST"
#define REQ_RESPONSE_TYPE	"REQUEST-RESPONSE"
#define NOTIFY_TYPE			"NOTIFY"
#define SOLICIT_TYPE 		"SOLICIT"

#define TYPE_BITS				"BITS"
#define TYPE_BOOLEAN			"BOOLEAN"
#define TYPE_ENUM				"ENUM"
#define TYPE_INTEGER			"INTEGER"
#define TYPE_INTEGER64		"INTEGER64"
#define TYPE_DOUBLE			"DOUBLE"
#define TYPE_STRING			"STRING"
#define TYPE_ARRAY			"ARRAY"

//网络版本协议版本及设备类型字段定义
#define NET_VISION			"VISION"
#define NET_DEVTYPE			"DEVTYPE"
//错误码
#define ERRORCODE				"ERRORCODE"
#define ERRORCAUSE			"ERRORCAUSE"

#define MEDIASTREAM_PT			"PT"
#define MEDIASTREAM_SSRC		"SSRC"
#define MEDIASTREAM_CSRC		"CSRC"
#define MEDIASTREAM_STREAMNAME	"STREAMNAME"

#define MEDIAIPANDPORT			"IPANDPORT"		//媒体ip与端口
#define MEDIATASKSTART			"MEDIATASKSTART"	//任务开始
#define MEDIATASKSTOP			"MEDIATASKSTOP"	//任务结束，一般是正常结束
#define MEDIAREGISTEFAILACK		"MEDIAREGISTEFAILACK"	//任务失败

#define MODEL_CONFIG			"CONFIGMODEL"			//参数模块
#define CONFIG_GET				"GET"					//获取参数
#define CONFIG_SET				"SET"					//设在参数
#define ERRORDESCRIPTION 		"ERRORDESCRIPTION"	//错误描述


}

//云台指令
#define PTZCONTROL_UP						1	//镜头旋转上
#define PTZCONTROL_DOWN					2	//镜头旋转下
#define PTZCONTROL_LEFT						3	//镜头旋转左
#define PTZCONTROL_RIGHT					4	//镜头旋转右
#define PTZCONTROL_IRIS_OPEN				5	//光圈 大
#define PTZCONTROL_IRIS_CLOSE			6	//光圈 小
#define PTZCONTROL_ZOOM_IN				7	//	调焦 缩
#define PTZCONTROL_ZOOM_OUT				8	//	调焦 伸
#define PTZCONTROL_FOCUS_NEAR			9	//聚焦 进
#define PTZCONTROL_FOCUS_FAR			10	//聚焦 远
#define PTZCONTROL_AUTOPAN				11	//自动
#define PTZCONTROL_BRUSH_ON				12
#define PTZCONTROL_BRUSH_OFF			13
#define PTZCONTROL_PRESET					14	//预置点
#define PTZCONTROL_RECALL					15//调用预置点
#define PTZCONTROL_CRUISE					16//巡航
#define PTZCONTROL_CLEARPRESET			17	//清除预置点
#define PTZCONTROL_SPEED					18
#define PTZCONTROL_STOP_CRUISE		19//停止巡航
#define PTZCONTROL_STOP						20
#define PTZCONTROL_CLEARALLPRESET		21//清楚所有预置点
#define PTZCONTROL_UP_LEFT				22	//左上
#define PTZCONTROL_UP_RIGHT		23	//右上
#define PTZCONTROL_DOWN_LEFT		24//左下
#define PTZCONTROL_DOWN_RIGHT			25//右下



#define SUCCESS_OK					0x00000000 //成功
#define GETDEVFAILED 				0x00000001	//设备获取失败
#define IDENTFAILED					0x00000002	//身份识别失败
#define AUTHENTIMEOUT				0x00000003	//认证超时
#define SOFAILED						0x00000004	//校验S0失败
#define NAMEORPASSWORDFAILED		0x00000005	//用户名或密码错误
#define EXECUFAILED					0x00000006	//执行失败
#define ANALYZEFAILED				0x00000007	//解析协议失败
#define CONMEDIASERVERFAILED		0x00000008	//链接媒体服务器失败
#define REGISTERMEDIASERVERFAILED	0x00000009	//媒体链路注册失败
#define CREATEMEDIATHREADFAILED 	0x0000000A	//创建媒体传输线程失败
#define NOTSUPPORTFUN				0x0000000B	//协议目前不支持该功能
#define ALLOCATEMEMORYFAILED		0x0000000C	//内存分配失败
#define NOTMATCHRESULES				0x0000000D	//没有查询到相符的结果
#define UNSTABLENET					0x0000000E	//网络不通
#define CONNECTEMAILSFAILED			0x0000000F	//连接email服务器失败
#define TIMEFAILED					0x00000010	//较时失败
#define OFFLINEFAILED				0x00000011	//强制下线失败
#define NORIGHT						0x00000012	//没有权限
#define OFFLINEBYLOWRIGHT			0x00000013	//权限低被迫下线
#define ADDNEWUSERFAILED			0x00000014	//添加新用户失败
#define SAMEUSERNAME					0x00000015	//用户名相同
#define EDITUSERFAILED				0x00000016	//编辑用户失败
#define DELETEUSERFAILED			0x00000017	//删除用户失败
#define TOOMANYUSERS					0x00000018	//在线用户太多
#define TASKEXIST						0x00000019	//任务存在
#define LACKRESOURCEORTASKFULL		0x0000001A	//资源不足或任务满
#define CHANNELILLEGAL				0x0000001B	//通道非法
#define UNCODEL						0x0000001C	//未编码
#define NOTSUPPORTMAINSTREAM		0x0000001D	//不支持主码流
#define NOTSUPPORTSUBSTREAM			0x0000001E	//不支持子码流
#define NOTSUPPORTMOBLIESTREAM		0x0000001F	//不支持手机码流
#define STARTPREVIEWFAILED			0x00000020	//开始实时预览失败
#define FILENOTEXIST					0x00000021	//文件不存在
#define GETUPGRADEPATHFAILED		0x00000022	//获取升级文件路失败
#define RECVUPGREADEDATAFAILED		0x00000023	//接收升级文件数据失败
#define CHECKUPGRADEFILEFAILED		0x00000024	//校验升级文件失败
#define OPENUPGRADEFILEFAILED		0x00000025	//打开升级文件失败
#define CATCHPICFAILED				0x00000026	//抓拍图片失败
#define SENDDATAFAILED				0x00000027	//发送数据失败
#define NOTASK						0x00000028	//没有该任务
#define UNKNOW						0x00000029	//未知错误
#define PARAM_ERROR					0x0000002A	//参数错误
#define TIME_ERROR					0x0000002B	//时间错误
#define LINK_TIME_OUT				0X0000002C	//（主要是测试网络服务的错误码EMAIL、DDNS、WIFI等）
#define OPERATEING					0X0000002D	//其他用户正在操作
#define OPERATE_SO_MUCH				0X0000002E	//操作太频繁
#define TESTING						0X0000002F	//测试中
#define SENDER_ADDR_ERROR			0X00000030	//发件人地址错误
#define RECVER_ADDR_ERROR			0X00000031	//收件人地址错误
#define SERVER_PARAM_ERROR			0X00000032	//服务器填写错误
#define NN_GET_DATA_FAILED				0X00000033	//从设备获取数据失败
#define NN_START_PLAYBACK_FAILED		0X00000034	//开始远程同步回放失败
#define NN_STOP_PLAYBACK_FAILED		0X00000035	//结束远程同步回放失败
#define NN_SEEK_FAILED					0X00000036	//拖拽失败
#define NN_UPGRADE_MAX					0x00000037	//升级用户过多
#define NN_NORIGHT						0x00000038	//用户没用该权限
#define NN_UPGRADE_VERSION_SAME			0x00000039	//升级文件版本号相同
#define NN_UPGRADEING					0x0000003A	//系统正在升级
#define NN_SERVER_PORT_ERROR			0x0000003B	//服务器端口填写错误
#define NN_WIFIMODE_NOTEXIST			0x0000003C	//wifi模块不存在
#define NN_WIFI_CLOSE					0x0000003D	//wifi开关关闭
#define NN_LINKING						0x0000003E	//链接中
#define NN_USER_MAC_ILLEGAL				0x0000003F	//用户mac非法
#define NN_PERMISSION_DENIED			0x00000040 //没有权限
#define NN_MEDIA_LINK_EXIST				0x00000041	//媒体链路存在
#define NN_DEV_NOT_EXIST					0x00000042//设备序列号不存在
#define NN_AUDIO_ENCODE_FAILED			0x00000043//起音频编码失败
#define NN_AUDIO_DECODE_FAILED			0x00000044//解音频失败
#define NN_START_TALK_FAILED			0x00000045//对讲失败
#define NN_DOWN_LOG_FAILED				0x00000046//下载日志失败




//错误描述
#define EP_CN_SUCCESS_OK					"SUCCESS"
#define EP_CN_GETDEVFAILED 					"GET FAILED"
#define EP_CN_IDENTFAILED					"IDENT FAILED"
#define EP_CN_AUTHENTIMEOUT					"AUTHEN TIMEOUT"
#define EP_CN_SOFAILED						"CHECK S0 FAILED"
#define EP_CN_NAMEORPASSWORDFAILED			"NAME OR PW ERROR"
#define EP_CN_EXECUFAILED					"EXECU FAILED"
#define EP_CN_ANALYZEFAILED					"ANALYZE FAILED"
#define EP_CN_CONMEDIASERVERFAILED			"CON MEDIA SERVER FAILED"
#define EP_CN_REGISTERMEDIASERVERFAILED	"REGISTER MEDIA SERVER FAILED"
#define EP_CN_CREATEMEDIATHREADFAILED 	"CREATE MEDIA THERAD FAILED"
#define EP_CN_NOTSUPPORTFUN					"NOT SUPPORT"
#define EP_CN_ALLOCATEMEMORYFAILED			"ALLOCATE MEMORY FAILED"
#define EP_CN_NOTMATCHRESULES				"NOT MATCH SRSULES"
#define EP_CN_UNSTABLENET					"NETWORK DISCONNECTED"
#define EP_CN_CONNECTEMAILSFAILED			"EMAIL SERVER DISCONNECTED"
#define EP_CN_TIMEFAILED					"TIME FAILED"
#define EP_CN_OFFLINEFAILED					"FORCED OFF LINE FAILED "
#define EP_CN_NORIGHT						"NO RIGHT"
#define EP_CN_OFFLINEBYLOWRIGHT			"OFF LINE BY LOW RIGHT"
#define EP_CN_ADDNEWUSERFAILED				"ADD FAILED"
#define EP_CN_SAMEUSERNAME					"SAME USERNAME"
#define EP_CN_EDITUSERFAILED				"EDIT FAILED"
#define EP_CN_DELETEUSERFAILED				"DELETE FAILED"
#define EP_CN_TOOMANYUSERS					"ONLINE USER IS FULL"
#define EP_CN_TASKEXIST						"TASK IS EXIST"
#define EP_CN_LACKRESOURCEORTASKFULL		"LACK OF RESOURCE OR TASK IS FULL "
#define EP_CN_CHANNELILLEGAL				"CHN ILLEGAL"
#define EP_CN_UNCODEL						"UNCODEL"
#define EP_CN_NOTSUPPORTMAINSTREAM			"NOT SUPPORT MAIN STREAM"
#define EP_CN_NOTSUPPORTSUBSTREAM			"NOT SUPPORT SUB STREAM"
#define EP_CN_NOTSUPPORTMOBLIESTREAM		"NOT SUPPORT MOBLIE STREAM"
#define EP_CN_STARTPREVIEWFAILED			"FAILED"
#define EP_CN_FILENOTEXIST					"NOT EXIST"
#define EP_CN_GETUPGRADEPATHFAILED			"PATH FAILED"
#define EP_CN_RECVUPGREADEDATAFAILED		"GET DATA FAILED"
#define EP_CN_CHECKUPGRADEFILEFAILED		"CHECK FILE DAILED"
#define EP_CN_OPENUPGRADEFILEFAILED		"OPEN FILE FAILED"
#define EP_CN_CATCHPICFAILED				"CATCH PIC FAILED"
#define EP_CN_SENDDATAFAILED				"SEND DATA FAILED"
#define EP_CN_NOTASK							"NO TASK"
#define EP_CN_UNKNOW							"UNKNOW"
#define EP_CN_PARAM_ERROR					"PARAM ERROR"
#define EP_CN_TIME_ERROR					"TIME ERROR"
#define EP_CN_LINK_TIME_OUT				"LINK TIME OUT"
#define EP_CN_OPERATEING					"OTHERS OPERATEING"
#define EP_CN_OPERATE_SO_MUCH				"OPERATE SO MUCH"
#define EP_CN_TESTING						"TESTING"
#define EP_CN_SENDER_ADDR_ERROR			"SENDER ADDR ERROR"
#define EP_CN_RECVER_ADDR_ERROR			"RECVER ADDR ERROR"
#define EP_CN_SERVER_PARAM_ERROR			"SERVER PARAM ERROR"
#define EP_CN_NN_GET_DATA_FAILED			"GET DATA FAILED FROM DEV"
#define EP_CN_NN_START_PLAYBACK_FAILED	"START PLAYBACK FAILED"
#define EP_CN_NN_STOP_PLAYBACK_FAILED	"STOP PLAYBACK FAILED"
#define EP_CN_NN_SEEK_FAILED				"SEEK FAILED"
#define EP_CN_NN_UPGRADE_MAX					"USER IS MORE"
#define EP_CN_NN_NORIGHT						"USER HAS NO RIGHT"
#define EP_CN_NN_UPGRADE_VERSION_SAME			"VERSION IS SAME"
#define EP_CN_NN_UPGRADEING					"UPGRADEING"
#define EP_CN_NN_SERVER_PORT_ERROR			"SERVER PORT ERROR"
#define EP_CN_NN_WIFIMODE_NOTEXIST			"WIFI MODE NOT EXIST"
#define EP_CN_NN_WIFI_CLOSE					 "WIFI CLOSE"
#define EP_CN_NN_LINKING						 "LINKING"
#define EP_CN_NN_USER_MAC_ILLEGAL				"USER_MAC_ILLEGAL"
#define EP_CN_NN_PERMISSION_DENIED				"PERMISSION DENIED"
#define EP_CN_NN_MEDIA_LINK_EXIST				"MEDIA LINK EXIST"
#define EP_CN_NN_DEV_NOT_EXIST					"DEV IS NOT EXIST"
#define EP_CN_NN_AUDIO_ENCODE_FAILED			"AUDIO ENCODE FAILED"
#define EP_CN_NN_AUDIO_DECODE_FAILED			"AUDIO DECODE FAILED"
#define EP_CN_NN_START_TALK_FAILED				"START TALK FAILED"
#define EP_NN_DOWN_LOG_FAILED					"DOWN LOG FAILED"




//硬盘错误码
#define NN_STORAGE_FULL						0x00000000	//硬盘满
#define NN_STORAGE_NOFORMAT					0x000000001//未格式化
#define NN_STORAGE_RWERROR					0x000000002//读写错误
#define NN_STORAGE_NOTRECORD					0x000000003//不录像
#define NN_STORAGE_NOTEXSIT						0x000000004//丢失
#define NN_STORAGE_UNKNOWN						0x000000005//无法识别

#define EP_CN_NN_STORAGE_FULL				"硬盘满"
#define EP_CN_NN_STORAGE_NOFORMAT			"未格式化"
#define EP_CN_NN_STORAGE_RWERROR			"读写错误"
#define EP_CN_NN_STORAGE_NOTRECORD			"不录像"
#define EP_CN_NN_STORAGE_NOTEXSIT			"丢失"
#define EP_CN_NN_STORAGE_UNKNOWN				"无法识别"
#endif /* BASE_H_ */
